package com.heiye.blog.oss.biz.api;

import com.heiye.blog.framework.common.response.Response;
import com.heiye.blog.oss.api.api.FileApi;
import com.heiye.blog.oss.api.model.dto.AudioStreamUploadDTO;
import com.heiye.blog.oss.biz.factory.FileStrategyFactory;
import com.heiye.blog.oss.biz.strategy.FileStrategy;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @author: heiye
 * @date: 2025/11/21 下午3:29
 * @version: v1.0.0
 * @description:  文件 API 接口实现类
 */
@Service
public class FileApiImpl implements FileApi {

    @Resource
    private FileStrategyFactory fileStrategyFactory;

    /**
     * 音频文件流式上传
     *
     * @param audioStreamUploadDTO
     * @return
     */
    @Override
    public Response<String> audioStreamUpload(AudioStreamUploadDTO audioStreamUploadDTO) {
        // 获取策略
        FileStrategy strategy = fileStrategyFactory.getStrategy();
        // 调用策略
        return Response.success(strategy.audioStreamUpload(audioStreamUploadDTO));
    }
}